# coding=utf-8
import re

# 匹配字符串结尾 $
# 匹配一个5-10为的qq邮箱
pattern = "[1-9]\d{4,9}@qq.com$"
qq = "12345@qq.com"
qq = "12345@qq.com.cn"
print(re.match(pattern, qq))
# 匹配字符串开头 ^
pattern = "^hello.*"
s = "hello world"
print(re.match(pattern, s))
# 匹配单词边界 \b
# 左边界
pattern = r".*\bqwe"
s = "abc qweAB"
print(re.match(pattern, s))
# 右边界
pattern = r".*ing\b"
s = "123 runing"
print(re.match(pattern, s))
# 匹配非单词边界 \B
# 左边界
pattern = r".*\Bqwe"
s = "abc aqweBC"
print(re.match(pattern, s))
# 右边界
pattern = r".*ing\B"
s = "123 runingA"
print(re.match(pattern, s))